#pragma once
#include "Globals.hpp"
#include "Timer.hpp"
#include "ClippingPlane.h"
#include "Vector2D.h"
#include "SuperData.h"

class Camera
{
public:
	Camera(); // The default constructor uses "ClipPlane" as the clipping plane
	Camera(ClippingPlane *clippingPlane); // Use the specified "ClipPlane" as the clipping plane

	void SetClippingPlane(ClippingPlane *clippingPlane); // Use the specified "ClipPlane" as the clipping plane

	void Update(Vector2D mouse, Uint8* keystates);
	void UpdateNoEarlyDelay(int direction);

	// accessor functions
	static void SetDelay(float delay)		{mDelay = delay;}
	static void SetDistance(int distance)	{mDistance = distance;}
	static void SetSpeed(int speed)			{mSpeed = speed;}
	void SetZoomPercent(float percent)		{mZoomPercent = percent;}

	enum Directions {
		Top, Left, Right, Bottom, TopRight, TopLeft, BottomRight, BottomLeft
	};
public:
	
	ClippingPlane* m_pClippingPlane;	// the clipping plane

	// private functions
	bool	InScrollingBounds(Coords mouse);
	Coords	GetDirection(Coords mouse);
	Coords	GetDirection(int direction);
	void	Scroll(Coords mouse);

	// member variables
	SDL_Rect		mLocation;
	Coords			mMouse;
	Timer			mWaitTimer, mAccelTimer;

	static float	mDelay;			// how long to wait before scrolling in MS
	static int		mDistance;		// how far away from the edge before we start scrolling
	static int		mSpeed;			// maxium scroll speed
	static int		mStopScrollingSpeed;	// the speed to stop scrolling at when deaccelerating
	int				mCurrSpeed;		// what our current scroll speed is
	float			mZoomPercent;	// the zoom level we are currently at
	bool			mAccel;
	bool			mDeaccel;
	bool			mResetAccel;
	float			mDeaccelValue;
	static float	mDeaccelRate;
	bool			mRunBigUpdate;
	Coords			mPrevDir;
	
};